export default function MapLoader() {
  return new Promise((resolve, reject) => {
    if (window.AMap) {
      resolve(window.AMap);
    } else {
		var script = document.createElement('script');
		script.type = "text/javascript";
		script.async = true;
		script.src = "https://webapi.amap.com/maps?v=2.0&key=e305cc0e3dd516846c01c6373e78da50&&plugin=AMap.DistrictSearch,AMap.Scale,AMap.HawkEye,AMap.ToolBar,AMap.ControlBar&callback=initAMap"; // v=1.4.15
		script.onerror = reject;
		document.head.appendChild(script);
    }
    window.initAMap  = () => {
      resolve(window.AMap);
    };
  });
}